package com.socket.transfer_file;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @ClassName: FileClient
 * @Author: ZhangYue26
 * @Description: 传输服务客户端
 * @Date: 2020-10-09
 */
public class FileClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost",8569);
        OutputStream outputStream = socket.getOutputStream();
        FileInputStream fileInputStream = new FileInputStream(new File("C:\\Users\\zhangyue26\\Desktop\\Java_lfasr4.1\\src\\main\\resources\\lib\\lfasr-sdk-3.0.0.jar"));
        byte[] bytes = new byte[1024];
        while (fileInputStream.read(bytes) != -1) {
            outputStream.write(bytes);
            outputStream.flush();
            bytes = new byte[1024];
        }
        outputStream.close();
        fileInputStream.close();
        System.out.println("客户端文件传输完毕！！");
    }
}
